home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / OCE Interfaces / OCE.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  45.3 KB  |  1,585 lines  |  [TEXT/MPS ]

  1. {***********************************************************
  2.  
  3. Created: Sunday, February 7, 1993 at 4:54PM
  4.  OCE.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.     ••• Apple Confidential •••
  8.     ••• Provided with AOCE Beta seed under license agreement with   •••
  9.     ••• Apple Computer, Inc.  Use for any purpose other than        •••
  10.     ••• development of AOCE-based Macintosh products is a violation •••
  11.     ••• of the license agreement.                                   •••
  12.  
  13.   Copyright Apple Computer, Inc. 1990-1993
  14.   All rights reserved
  15.  
  16. ***********************************************************}
  17.  
  18.  
  19. {$IFC UNDEFINED UsingIncludes}
  20. {$SETC UsingIncludes:= 0}
  21. {$ENDC}
  22.  
  23. {$IFC NOT UsingIncludes}
  24.     UNIT OCE;
  25.     INTERFACE
  26. {$ENDC}
  27.  
  28. {$IFC UNDEFINED UsingOCE}
  29. {$SETC UsingOCE:= 1}
  30.  
  31. {$I+}
  32. {$SETC OCEIncludes:= UsingIncludes}
  33. {$SETC UsingIncludes:= 1}
  34.  
  35.  
  36.  
  37. {$IFC UNDEFINED UsingAliases}
  38. {$I $$Shell(PInterfaces)Aliases.p}        { for AliasPtr }
  39. {$ENDC}
  40.  
  41. {$IFC UNDEFINED UsingAppleEvents}
  42. {$I $$Shell(PInterfaces)AppleEvents.p}    { for DescType }
  43. {$ENDC}
  44.  
  45. {$IFC UNDEFINED UsingScript}
  46. {$I $$Shell(PInterfaces)Script.p}        { for smRoman }
  47. {$ENDC}
  48.  
  49. {$IFC UNDEFINED UsingTypes}
  50. {$I $$Shell(PInterfaces)Types.p}
  51. {$ENDC}
  52.  
  53. {$SETC UsingIncludes:= OCEIncludes}
  54.  
  55.  
  56. {
  57. All utility routines defined here are callable at interrupt level.  Currently,
  58. this is done at the expense of not using the international utilities package
  59. for STRING comparisons (we just use the ROM-based RelString trap).
  60. }
  61.  
  62.  
  63. {
  64. Defines for the trap selector values.
  65.  
  66. Note:  Some selector values also chosen from this same range of numbers appear
  67. in the file OCEMessaging.h.  Check there before you add a new value.
  68. }
  69.  
  70. CONST
  71. kOCECopyCreationID                    = 768;
  72. kOCECopyDirDiscriminator            = 769;
  73. kOCECopyLocalRecordID                = 770;
  74. kOCECopyPackedDSSpec                = 771;
  75. kOCECopyPackedPathName                = 772;
  76. kOCECopyPackedRLI                    = 773;
  77. kOCECopyPackedRecordID                = 774;
  78. kOCECopyRLI                            = 775;
  79. kOCECopyRString                        = 776;
  80. kOCECopyRecordID                    = 777;
  81. kOCECopyShortRecordID                = 778;
  82. kOCEDuplicateRLI                    = 779;
  83. kOCEEqualCreationID                    = 780;
  84. kOCEEqualDirDiscriminator            = 781;
  85. kOCEEqualDSSpec                        = 782;
  86. kOCEEqualLocalRecordID                = 783;
  87. kOCEEqualPackedDSSpec                = 784;
  88. kOCEEqualPackedPathName                = 785;
  89. kOCEEqualPackedRecordID                = 786;
  90. kOCEEqualPackedRLI                    = 787;
  91. kOCEEqualRecordID                    = 788;
  92. kOCEEqualRLI                        = 789;
  93. kOCEEqualRString                    = 790;
  94. kOCEEqualShortRecordID                = 791;
  95. kOCEExtractAlias                    = 792;
  96. kOCEGetDSSpecInfo                    = 793;
  97. kOCEGetIndAttributeType                = 794;
  98. kOCEGetIndRecordType                = 795;
  99. kOCEGetXtnType                        = 796;
  100. kOCEIsNullPackedPathName            = 797;
  101. kOCENewLocalRecordID                = 798;
  102. kOCENewRLI                            = 799;
  103. kOCENewRecordID                        = 800;
  104. kOCENewShortRecordID                = 801;
  105. kOCEPackDSSpec                        = 802;
  106. kOCEPackPathName                    = 803;
  107. kOCEPackRLI                            = 804;
  108. kOCEPackRLIParts                    = 805;
  109. kOCEPackRecordID                    = 806;
  110. kOCEPackedDSSpecSize                = 807;
  111. kOCEPackedPathNameSize                = 808;
  112. kOCEPackedRLIPartsSize                = 809;
  113. kOCEPackedRLISize                    = 810;
  114. kOCEPackedRecordIDSize                = 811;
  115. kOCEDNodeNameCount                    = 812;
  116. kOCERelRString                        = 813;
  117. kOCESetCreationIDtoNull                = 814;
  118. kOCEUnpackDSSpec                    = 815;
  119. kOCEUnpackPathName                    = 816;
  120. kOCEUnpackRLI                        = 817;
  121. kOCEUnpackRecordID                    = 818;
  122. kOCEValidPackedDSSpec                = 819;
  123. kOCEValidPackedPathName                = 820;
  124. kOCEValidPackedRecordID                = 821;
  125. kOCEValidPackedRLI                    = 822;
  126. kOCEValidRLI                        = 823;
  127. kOCEValidRString                    = 824;
  128. kOCECToRString                        = 825;
  129. kOCEPToRString                        = 826;
  130. kOCERToPString                        = 827;
  131. kOCEPathFinderCID                    = 828;
  132. kOCEStreamPackedDSSpec                = 829;
  133.  
  134. kOCENullCID                            = 836;
  135. kOCEGetAccessControlDSSpec            = 837;
  136. kOCEGetRootPackedRLI                = 838;
  137.  
  138.  
  139.  
  140.  
  141. TYPE
  142. OCERecordTypeIndex = INTEGER;
  143. OCEAttributeTypeIndex = INTEGER;
  144.  
  145.  
  146. {
  147. All these standard definitions begin with the Apple symbol (not shown here).
  148.  
  149. NOTE:  To access these, you must call OCEGetIndRecordType or OCEGetIndAttributeType
  150. with the proper index.  These routines return pointers to the standard type.
  151. This was done so that code fragments (INITs, CDEVs, DSAMs, etc). which cannot
  152. use global data can also use these.
  153. }
  154.  
  155. { Indices for the standard definitions for certain record types (OCERecordTypeIndex): }
  156.  
  157. CONST
  158. kUserRecTypeNum             = 1;        { "User" }
  159. kGroupRecTypeNum            = 2;        { "Group" }
  160. kMnMRecTypeNum                = 3;        { "AppleMail™ M&M" }
  161. kMnMForwarderRecTypeNum        = 4;        { "AppleMail™ Fwdr" }
  162. kNetworkSpecRecTypeNum        = 5;        { "NetworkSpec" }
  163. kADAPServerRecTypeNum        = 6;        { "ADAP Server" }
  164. kADAPDNodeRecTypeNum        = 7;        { "ADAP DNode" }
  165. kADAPDNodeRepRecTypeNum        = 8;        { "ADAP DNode Rep" }
  166. kWildCardRecTypeNum            = 9;        { "=" }
  167. kDirectoryRecTypeNum        = 10;        { "Directory" }
  168. kDNodeRecTypeNum            = 11;        { "DNode" }
  169. kSetupRecTypeNum            = 12;        { "Setup" }
  170. kMSAMRecTypeNum                = 13;        { "MSAM" }
  171. kDSAMRecTypeNum                = 14;        { "DSAM" }
  172. kAttributeValueRecTypeNum    = 15;        { "Attribute Value" }
  173. kBusinessCardRecTypeNum        = 16;        { "Business Card" }
  174. kMailServiceRecTypeNum        = 17;        { "Mail Service" }
  175. kCombinedRecTypeNum            = 18;        { "Combined" }
  176.  
  177. kFirstOCERecTypeNum    = kUserRecTypeNum;            { first standard OCE record type }
  178. kLastOCERecTypeNum    = kCombinedRecTypeNum;    { last standard OCE record type }
  179. kNumOCERecTypes        = (kLastOCERecTypeNum - kFirstOCERecTypeNum + 1);
  180.  
  181.  
  182. { Indices for the standard definitions for certain attribute types (OCEAttributeTypeIndex): }
  183.  
  184. kMemberAttrTypeNum            = 1001;        { "Member" }
  185. kAdminsAttrTypeNum            = 1002;        { "Administrators" }
  186. kMailSlotsAttrTypeNum        = 1003;        { "mailslots" }
  187. kPrefMailAttrTypeNum        = 1004;        { "pref mailslot" }
  188. kAddressAttrTypeNum            = 1005;        { "Address" }
  189. kPictureAttrTypeNum            = 1006;        { "Picture" }
  190. kAuthKeyAttrTypeNum            = 1007;        { "auth key" }
  191. kTelephoneAttrTypeNum        = 1008;        { "Telephone" }
  192. kNBPNameAttrTypeNum            = 1009;        { "NBP Name" }
  193. kQMappingAttrTypeNum        = 1010;        { "ForwarderQMap" }
  194. kDialupSlotAttrTypeNum        = 1011;        { "DialupSlotInfo" }
  195. kHomeNetAttrTypeNum            = 1012;        { "Home Internet" }
  196. kCoResAttrTypeNum            = 1013;        { "Co-resident M&M" }
  197. kFwdrLocalAttrTypeNum        = 1014;        { "FwdrLocalRecord" }
  198. kConnectAttrTypeNum            = 1015;        { "Connected To" }
  199. kForeignAttrTypeNum            = 1016;        { "Foreign RLIs" }
  200. kOwnersAttrTypeNum            = 1017;        { "Owners" }
  201. kReadListAttrTypeNum        = 1018;        { "ReadList" }
  202. kWriteListAttrTypeNum        = 1019;        { "WriteList" }
  203. kDescriptorAttrTypeNum        = 1020;        { "Descriptor" }
  204. kCertificateAttrTypeNum        = 1021;        { "Certificate" }
  205. kMsgQsAttrTypeNum            = 1022;        { "MessageQs" }
  206. kPrefMsgQAttrTypeNum        = 1023;        { "PrefMessageQ" }
  207. kMasterPFAttrTypeNum        = 1024;        { "MasterPF" }
  208. kMasterNetSpecAttrTypeNum    = 1025;        { "MasterNetSpec" }
  209. kServersOfAttrTypeNum        = 1026;        { "Servers Of" }
  210. kParentCIDAttrTypeNum        = 1027;        { "Parent CID" }
  211. kNetworkSpecAttrTypeNum        = 1028;        { "NetworkSpec" }
  212. kLocationAttrTypeNum        = 1029;        { "Location" }
  213. kTimeSvrTypeAttrTypeNum        = 1030;        { "TimeServer Type" }
  214. kUpdateTimerAttrTypeNum        = 1031;        { "Update Timer" }
  215. kShadowsOfAttrTypeNum        = 1032;        { "Shadows Of" }
  216. kShadowServerAttrTypeNum    = 1033;        { "Shadow Server" }
  217. kTBSetupAttrTypeNum            = 1034;        { "TB Setup" }
  218. kMailSetupAttrTypeNum        = 1035;        { "Mail Setup" }
  219. kSlotIDAttrTypeNum            = 1036;        { "SlotID" }
  220. kGatewayFileIDAttrTypeNum    = 1037;        { "Gateway FileID" }
  221. kMailServiceAttrTypeNum        = 1038;        { "Mail Service" }
  222. kStdSlotInfoAttrTypeNum        = 1039;        { "Std Slot Info" }
  223. kAssoDirectoryAttrTypeNum    = 1040;        { "Asso. Directory" }
  224. kDirectoryAttrTypeNum        = 1041;        { "Directory" }
  225. kDirectoriesAttrTypeNum        = 1042;        { "Directories" }
  226. kSFlagsAttrTypeNum            = 1043;        { "SFlags" }
  227. kLocalNameAttrTypeNum        = 1044;        { "Local Name" }
  228. kLocalKeyAttrTypeNum        = 1045;        { "Local Key" }
  229. kDirUserRIDAttrTypeNum        = 1046;        { "Dir User RID" }
  230. kDirUserKeyAttrTypeNum        = 1047;        { "Dir User Key" }
  231. kDirNativeNameAttrTypeNum    = 1048;        { "Dir Native Name" }
  232. kCommentAttrTypeNum            = 1049;        { "Comment" }
  233. kRealNameAttrTypeNum        = 1050;        { "Real Name" }
  234. kPrivateDataAttrTypeNum        = 1051;        { "Private Data" }
  235. kDirTypeAttrTypeNum            = 1052;        { "Directory Type" }
  236. kDSAMFileAliasAttrTypeNum    = 1053;        { "DSAM File Alias" }
  237. kCanAddressToAttrTypeNum    = 1054;        { "Can Address To" }
  238. kDiscriminatorAttrTypeNum    = 1055;        { "Discriminator" }
  239. kAliasAttrTypeNum            = 1056;        { "Alias" }
  240. kParentMSAMAttrTypeNum        = 1057;        { "Parent MSAM" }
  241. kParentDSAMAttrTypeNum        = 1058;        { "Parent DSAM" }
  242. kSlotAttrTypeNum            = 1059;        { "Slot" }
  243. kAssoMailServiceAttrTypeNum    = 1060;        { "Asso. Mail Service" }
  244. kFakeAttrTypeNum            = 1061;        { "Fake" }
  245. kInheritSysAdminAttrTypeNum    = 1062;        { "Inherit SysAdministrators" }
  246.  
  247.  
  248. kFirstOCEAttrTypeNum    = kMemberAttrTypeNum;    { first standard OCE attr type }
  249. kLastOCEAttrTypeNum        = kInheritSysAdminAttrTypeNum;    { last standard OCE attr type }
  250. kNumOCEAttrTypes        = (kLastOCEAttrTypeNum - kFirstOCEAttrTypeNum + 1);
  251.  
  252.  
  253. { For anyone who absolutely needs a define of the body of the standard record or
  254. attribute type, use these below.  CAUTION!  All the types below are assumed to be
  255. in character set 'smRoman'.  If you try to compare these to some RString or
  256. AttributeType variable, you must take the character set code into account.  Future
  257. standard types may be defined using character sets other than 'smRoman'.  The
  258. first character of each of these is $F0, the Apple symbol.
  259. }
  260.  
  261. { Standard definitions for certain record types: }
  262.  
  263. kUserRecTypeBody                 = 'User';
  264. kGroupRecTypeBody                = 'Group';
  265. kMnMRecTypeBody                    = 'AppleMail™ M&M';
  266. kMnMForwarderRecTypeBody        = 'AppleMail™ Fwdr';
  267. kNetworkSpecRecTypeBody            = 'NetworkSpec';
  268. kADAPServerRecTypeBody            = 'ADAP Server';
  269. kADAPDNodeRecTypeBody            = 'ADAP DNode';
  270. kADAPDNodeRepRecTypeBody        = 'ADAP DNode Rep';
  271. kWildCardRecTypeBody            = 'NO LONGER USED';
  272. kDirectoryRecTypeBody            = 'Directory';
  273. kDNodeRecTypeBody                = 'DNode';
  274. kSetupRecTypeBody                = 'Setup';
  275. kMSAMRecTypeBody                = 'MSAM';
  276. kDSAMRecTypeBody                = 'DSAM';
  277. kAttributeValueRecTypeBody        = 'Attribute Value';
  278. kBusinessCardRecTypeBody        = 'Business Card';
  279. kMailServiceRecTypeBody            = 'Mail Service';
  280. kCombinedRecTypeBody            = 'Combined';
  281.  
  282. { Standard definitions for certain attribute types: }
  283.  
  284. kMemberAttrTypeBody                = 'Member';
  285. kAdminsAttrTypeBody                = 'Administrators';
  286. kMailSlotsAttrTypeBody            = 'mailslots';
  287. kPrefMailAttrTypeBody            = 'pref mailslot';
  288. kAddressAttrTypeBody            = 'Address';
  289. kPictureAttrTypeBody            = 'Picture';
  290. kAuthKeyAttrTypeBody            = 'auth key';
  291. kTelephoneAttrTypeBody            = 'Telephone';
  292. kNBPNameAttrTypeBody            = 'NBP Name';
  293. kQMappingAttrTypeBody            = 'ForwarderQMap';
  294. kDialupSlotAttrTypeBody            = 'DialupSlotInfo';
  295. kHomeNetAttrTypeBody            = 'Home Internet';
  296. kCoResAttrTypeBody                = 'Co-resident M&M';
  297. kFwdrLocalAttrTypeBody            = 'FwdrLocalRecord';
  298. kConnectAttrTypeBody            = 'Connected To';
  299. kForeignAttrTypeBody            = 'Foreign RLIs';
  300. kOwnersAttrTypeBody                = 'Owners';
  301. kReadListAttrTypeBody            = 'ReadList';
  302. kWriteListAttrTypeBody            = 'WriteList';
  303. kDescriptorAttrTypeBody            = 'Descriptor';
  304. kCertificateAttrTypeBody        = 'Certificate';
  305. kMsgQsAttrTypeBody                = 'MessageQs';
  306. kPrefMsgQAttrTypeBody            = 'PrefMessageQ';
  307. kMasterPFAttrTypeBody            = 'MasterPF';
  308. kMasterNetSpecAttrTypeBody        = 'MasterNetSpec';
  309. kServersOfAttrTypeBody            = 'Servers Of';
  310. kParentCIDAttrTypeBody            = 'Parent CID';
  311. kNetworkSpecAttrTypeBody        = 'NetworkSpec';
  312. kLocationAttrTypeBody            = 'Location';
  313. kTimeSvrTypeAttrTypeBody        = 'TimeServer Type';
  314. kUpdateTimerAttrTypeBody        = 'Update Timer';
  315. kShadowsOfAttrTypeBody            = 'Shadows Of';
  316. kShadowServerAttrTypeBody        = 'Shadow Server';
  317. kTBSetupAttrTypeBody            = 'TB Setup';
  318. kMailSetupAttrTypeBody            = 'Mail Setup';
  319. kSlotIDAttrTypeBody                = 'SlotID';
  320. kGatewayFileIDAttrTypeBody        = 'Gateway FileID';
  321. kMailServiceAttrTypeBody        = 'Mail Service';
  322. kStdSlotInfoAttrTypeBody        = 'Std Slot Info';
  323. kAssoDirectoryAttrTypeBody        = 'Asso. Directory';
  324. kDirectoryAttrTypeBody            = 'Directory';
  325. kDirectoriesAttrTypeBody        = 'Directories';
  326. kSFlagsAttrTypeBody                = 'SFlags';
  327. kLocalNameAttrTypeBody            = 'Local Name';
  328. kLocalKeyAttrTypeBody            = 'Local Key';
  329. kDirUserRIDAttrTypeBody            = 'Dir User RID';
  330. kDirUserKeyAttrTypeBody            = 'Dir User Key';
  331. kDirNativeNameAttrTypeBody        = 'Dir Native Name';
  332. kCommentAttrTypeBody            = 'Comment';
  333. kRealNameAttrTypeBody            = 'Real Name';
  334. kPrivateDataAttrTypeBody        = 'Private Data';
  335. kDirTypeAttrTypeBody            = 'Directory Type';
  336. kDSAMFileAliasAttrTypeBody        = 'DSAM File Alias';
  337. kCanAddressToAttrTypeBody        = 'Can Address To';
  338. kDiscriminatorAttrTypeBody        = 'Discriminator';
  339. kAliasAttrTypeBody                = 'Alias';
  340. kParentMSAMAttrTypeBody            = 'Parent MSAM';
  341. kParentDSAMAttrTypeBody            = 'Parent DSAM';
  342. kSlotAttrTypeBody                = 'Slot';
  343. kAssoMailServiceAttrTypeBody    = 'Asso. Mail Service';
  344. kFakeAttrTypeBody                = 'Fake';
  345. kInheritSysAdminAttrTypeBody    = 'Inherit SysAdministrators';
  346.  
  347.  
  348.  
  349. { Miscellaneous enums: }
  350.  
  351. kRString32Size            = 32;            { max size of the body field in RString32 }
  352. kRString64Size            = 64;            { max size of the body field in RString64 }
  353. kNetworkSpecMaxBytes    = 32;            { max size of the body field in NetworkSpec }
  354. kPathNameMaxBytes        = 1024;            { max size of the data field in PackedPathName }
  355. kDirectoryNameMaxBytes    = 32;            { max size of the body field in DirectoryName }
  356. kAttributeTypeMaxBytes    = 32;            { max size of the body field in AttributeType }
  357. kAttrValueMaxBytes        = 32768;        { max size of any attribute value }
  358. kRStringMaxBytes        = 256;            { max size (bytes: in) of the body field of a recordName or recordType }
  359. kRStringMaxChars        = 128;            { max size (chars: in) of the body field of a recordName or recordType }
  360.  
  361.  
  362.  
  363. kNULLDNodeNumber = 0;                    { Special value meaning none specified }
  364. kRootDNodeNumber = 2;                    { DNodeNum corresponding to the root of the tree }
  365.  
  366.  
  367.  
  368.  
  369. {
  370. This enum is used to select the kind of RString in calls such as OCERelRString,
  371. OCEEqualRString, and OCEValidRString.
  372.  
  373. eGenericSensitive and eGenericInsensitive are enumerators that can be used if you
  374. use RStrings for things other than what you see in this file.  If you want them to
  375. be compared in a case- and diacritical-sensitive manner (c ≠ C ≠ ç), use
  376. eGenericSensitive.  If you want them to be compared in a case- and diacritical-
  377. insensitive manner (c = C = ç), use eGenericInensitive.
  378. WARNING:  do not use eGenericSensitive and eGenericInsensitive with directory
  379. names, entity names, pathname parts, entity types, network specs, or attribute
  380. types!  Don't assume that you know how they should be compared!!!
  381. }
  382.  
  383. { values of RStringKind }
  384. CONST
  385. kOCEDirName                        = 0;
  386. kOCERecordOrDNodeName            = 1;
  387. kOCERecordType                    = 2;
  388. kOCENetworkSpec                    = 3;
  389. kOCEAttrType                    = 4;
  390. kOCEGenericSensitive            = 5;
  391. kOCEGenericInsensitive            = 6;
  392.  
  393. TYPE
  394. RStringKind = INTEGER;
  395.  
  396.  
  397. { Values for the signature field in Discriminator }
  398.  
  399. { values of OCEDirectoryKind }
  400. CONST
  401. kDirAllKinds                = 0;
  402. kDirADAPKind                = 'adap';
  403. kDirPersonalDirectoryKind    = 'pdir';
  404. kDirDSAMKind                = 'dsam';
  405.  
  406. TYPE
  407. OCEDirectoryKind = LONGINT;
  408.  
  409.  
  410. { Values returned by GetDSSpecInfo() }
  411. CONST
  412. kOCEInvalidDSSpec    = '????';            { could not be determined }
  413. kOCEDirsRootDSSpec    = 'drt';            { root of all directories ("Directory" icon) }
  414. kOCEDirectoryDSSpec    = 'dir';            { directory }
  415. kOCEDNodeDSSpec        = 'dno';            { d-node }
  416. kOCERecordDSSpec    = 'rec';            { record }
  417. kOCEentnDSSpec        = 'entn';            { extensionType is 'entn' }
  418. kOCENOTentnDSSpec    = 'not';            { extensionType is not 'entn' }
  419.  
  420.  
  421.  
  422.  
  423. { Values for AttributeTag }
  424. typeRString            = 'rstr';
  425. typePackedDSSpec    = 'dspc';
  426. typeBinary            = 'bnry';
  427.  
  428.  
  429.  
  430.  
  431. {
  432. Bit flag corresponding to the isCluster bit.  Use it like this:
  433.     if (foo & kIsCluster)
  434.         then this is a cluster!
  435. kForeignNode is used to indicate nodes in the name hierarchy that correspond to
  436. foreign directories (meaning ADAP sees no clusters or DNodes beneath it, but
  437. mail routers might be able to route to clusters beneath it.
  438. }
  439.  
  440. kIsClusterBit = 0;
  441. kForeignNodeBit = 1;
  442.  
  443. { values of DirNodeKind }
  444. kIsCluster        = $00000001;  {1<<kIsClusterBit}
  445. kForeignNode    = $00000002;  {1<<kForeignNodeBit}
  446.  
  447. TYPE
  448. DirNodeKind = LONGINT;
  449.  
  450.  
  451.  
  452.  
  453. {*** Toolbox Control ***}
  454.  
  455. {
  456. We will have a version number and attributes for toolboxes off the aa5e trap
  457. and the S&F server trap.
  458.  
  459. This includes the OCE toolbox and S&F Server.  [Note: the S&F server will
  460. change to ONLY service ServerGateway calls —it will then be necessary to run
  461. it co–resident with an OCE toolbox].
  462.  
  463. The high order word will represent the S&F Server version number.  The low
  464. order word will represent the OCE toolbox version number.  These will be zero
  465. until the component is up and running.  It is not possible to know these
  466. a–priori. Note: there will not be a seperate version numbers for each component
  467. in the OCE toolbox or S&F server.
  468.  
  469. The above is consistent with the standard System 7.0 usage of Gestalt.
  470.  
  471. The oce tb attribute gestaltOCETBPresent implies the existence of OCE on a
  472. machine.
  473.  
  474. The OCE TB attribute gestaltOCETBAvailable implies the availablity of OCE calls.
  475.  
  476. The attribute gestaltOCESFServerAvailable implies the availablity of OCE calls
  477. available through the S&F server. This are essentially the server gateway calls.
  478.  
  479. Any (future) remaining OCE attributes may not be established correctly until
  480. the attribute gestaltOCETBAvailable is set.
  481.  
  482. The gestalt selectors and values are listed below:
  483. }
  484.  
  485. CONST
  486. gestaltOCEToolboxVersion    = 'ocet';    { OCE Toolbox version }
  487. gestaltOCEToolboxAttr        = 'oceu';    { OCE Toolbox attributes }
  488.  
  489.  
  490.  
  491. { version includes:
  492.  *  dirtb
  493.  *  authtb
  494.  *  mailtb
  495.  *  ipmtb
  496.  *  personal directory
  497.  *  ADSPSecure
  498.  * e.g. all interfaces dependent on the aa5e trap.
  499. }
  500. gestaltOCETB                = $0100;    { OCE Toolbox version 1.0 }
  501. gestaltSFServer                = $0100;    { S&F Server version 1.0 }
  502. gestaltOCETBPresent            = $1;        { OCE toolbox is present, not running }
  503. gestaltOCETBAvailable        = $2;        { OCE toolbox is running and available }
  504. gestaltOCESFServerAvailable    = $4;        { S&F Server is running and available }
  505.  
  506.  
  507. {    Constants used for Transitions. }
  508.  
  509. ATTransIPMStart        = 'ipms';
  510. ATTransIPMShutdown    = 'ipmd';
  511. ATTransDirStart        = 'dirs';
  512. ATTransDirShutdown    = 'dird';
  513. ATTransAuthStart    = 'auts';
  514. ATTransAuthShutdown    = 'autd';
  515. ATTransSFStart        = 's&fs';
  516. ATTransSFShutdown    = 's&fd';
  517.  
  518.  
  519.  
  520.  
  521.  
  522. { Some definitions for time-related parameters: }
  523.  
  524. TYPE
  525. UTCTime = LONGINT;                        { Interpreted as UTC seconds since 1/1/1904 }
  526. UTCOffset = LONGINT;                    { seconds EAST of Greenwich }
  527.  
  528.  
  529. CharacterSet = INTEGER;                    { This is the same as the ScriptManager script. }
  530.  
  531.  
  532. {*** RString ***}
  533.  
  534.  
  535. {
  536. struct RString is a maximum-sized structure.  Allocate one of these and it will
  537. hold any valid RString.
  538. }
  539.  
  540. RStringHeader = RECORD
  541.     charSet: CharacterSet;
  542.     dataLength: INTEGER;
  543.     END;
  544.  
  545. RString = RECORD
  546.     charSet: CharacterSet;
  547.     dataLength: INTEGER;
  548.  
  549.     body: PACKED ARRAY[1..kRStringMaxBytes] OF Byte;        { place for characters }
  550.     END;
  551.  
  552.  
  553. { struct ProtoRString is a minimum-sized structure.  Use this for a variable-length
  554. RString. }
  555.  
  556. ProtoRString = RECORD                    { proto-RString used for variable length rStrings }
  557.     charSet: CharacterSet;
  558.     dataLength: INTEGER;
  559.  
  560.     { Followed by body }
  561.     END;
  562.  
  563. RStringPtr = ^RString;
  564. RStringHandle = ^RStringPtr;
  565. ProtoRStringPtr = ^ProtoRString;
  566.  
  567. CONST
  568. kMinPackedRStringLength = sizeof(ProtoRString);
  569.  
  570.  
  571. TYPE
  572. RString64 = RECORD
  573.     charSet: CharacterSet;
  574.     dataLength: INTEGER;
  575.  
  576.     body: PACKED ARRAY[1..kRString64Size] OF Byte;
  577.     END;
  578.  
  579. RString32 = RECORD
  580.     charSet: CharacterSet;
  581.     dataLength: INTEGER;
  582.  
  583.     body: PACKED ARRAY[1..kRString32Size] OF Byte;
  584.     END;
  585.  
  586.  
  587.  
  588.  
  589. {
  590. Standard definitions for the entity type field and attribute type
  591. have been moved to the end of the file.
  592. }
  593.  
  594.  
  595. {
  596. Copies str1 to str2.  str2Length is the size of str2, excluding header.
  597. A memFull error will be returned if that is not as large as str1->length.
  598. }
  599.  
  600. FUNCTION OCECopyRString(str1: RString; VAR str2: RString; str2Length: INTEGER): OSErr;
  601.     INLINE $303C, kOCECopyRString, $AA5C;
  602.  
  603.  
  604. {    Make an RString from a C STRING.  If the c STRING is bigger than rStrLength,
  605. only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  606.  
  607. PROCEDURE OCECToRString(cStr: Ptr; charSet: CharacterSet; VAR rStr: RString;
  608.         rStrLength: INTEGER);
  609.     INLINE $303C, kOCECToRString, $AA5C;
  610.  
  611.  
  612. {    Make an RString from a Pascal STRING.  If the Pascal STRING is bigger than rStrLength,
  613. only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  614.  
  615. PROCEDURE OCEPToRString(pStr: Str255; charSet: CharacterSet; rStr: RStringPtr;
  616.         rStrLength: INTEGER);
  617.     INLINE $303C, kOCEPToRString, $AA5C;
  618.  
  619.  
  620. {    Make a Pascal STRING from an RString.  It's up to you to check the CHAR set of
  621. the RString, or if the length of the RString is greater than 255 (the Pascal STRING's
  622. length will simply be the lower byte of the RString's length).  The StringPtr that is
  623. returned will point directly into the RString (no memory will be allocated). }
  624.  
  625. FUNCTION OCERToPString(rStr: RStringPtr): StringPtr; INLINE $303C, kOCERToPString, $AA5C;
  626.  
  627.  
  628. {    Check the relative equality of two RStrings.  Determines if str1 is greater than,
  629. equal to, or less than str2.  Result types for OCERelRString are defined in <OSUtils.h>
  630. (same as for RelString). }
  631.  
  632. FUNCTION OCERelRString(str1: UNIV Ptr; str2: UNIV Ptr; kind: RStringKind): INTEGER;
  633.     INLINE $303C, kOCERelRString, $AA5C;
  634.  
  635.  
  636. {    Check for equality of two RStrings. Returns true if equal. }
  637.  
  638. FUNCTION OCEEqualRString(str1: UNIV Ptr; str2: UNIV Ptr; kind: RStringKind): BOOLEAN;
  639.     INLINE $303C, kOCEEqualRString, $AA5C;
  640.  
  641.  
  642. {    Check the validity of an RString.  Returns true if the RString is valid }
  643.  
  644. FUNCTION OCEValidRString(str: UNIV Ptr; kind: RStringKind): BOOLEAN;
  645.     INLINE $303C, kOCEValidRString, $AA5C;
  646.  
  647.  
  648.  
  649.  
  650. {*** CreationID ***}
  651.  
  652. TYPE
  653. CreationID = RECORD
  654.     source: LONGINT;                    { Fields definitions and usage are not defined }
  655.     seq: LONGINT;
  656.     END;
  657.  
  658. AttributeCreationID = CreationID;
  659. CreationIDPtr = ^CreationID;
  660.  
  661.  
  662.  
  663.  
  664. { Returns a pointer to a null CreationID . }
  665.  
  666. FUNCTION OCENullCID: CreationIDPtr;
  667.     INLINE $303C, kOCENullCID, $AA5C;
  668.  
  669.  
  670. { Returns a pointer to a special CreationID used within the PathFinder. }
  671.  
  672. FUNCTION OCEPathFinderCID: CreationIDPtr;
  673.     INLINE $303C, kOCEPathFinderCID, $AA5C;
  674.  
  675.  
  676. { Sets the CreationID to a null value. }
  677.  
  678. PROCEDURE OCESetCreationIDtoNull(VAR cid: CreationID);
  679.     INLINE $303C, kOCESetCreationIDtoNull, $AA5C;
  680.  
  681.  
  682. { Copies the value of cid1 to cid2. }
  683.  
  684. PROCEDURE OCECopyCreationID(cid1: CreationID; VAR cid2: CreationID);
  685.     INLINE $303C, kOCECopyCreationID, $AA5C;
  686.  
  687.  
  688. { Check the equality of two CreationIDs. }
  689.  
  690. FUNCTION OCEEqualCreationID(cid1: CreationID; cid2: CreationID): BOOLEAN;
  691.     INLINE $303C, kOCEEqualCreationID, $AA5C;
  692.  
  693.  
  694.  
  695.  
  696. {*** NetworkSpec ***}
  697.  
  698. {
  699. For the record, a NetworkSpec is an RString with a smaller maximum size.
  700. I don't justtypedef it to an RString, because I want the definition of the NetworkSpec
  701. struct to contain the max length.  But it should be possible to typecast any
  702. NetworkSpec to an RString and use all the RString utilities on it.
  703. }
  704.  
  705. TYPE
  706. NetworkSpec = RECORD
  707.     charSet: CharacterSet;
  708.     dataLength: INTEGER;
  709.  
  710.     body: PACKED ARRAY[1..kNetworkSpecMaxBytes] OF Byte;    { always fixed at the max size }
  711.     END;
  712.  
  713. NetworkSpecPtr = ^NetworkSpec;
  714.  
  715.  
  716.  
  717. {*** PackedPathName ***}
  718.  
  719. {
  720. struct PackedPathName is a maximum-sized structure.  Allocate one of
  721. these and it will hold any valid packed pathname.
  722. }
  723.  
  724. PackedPathNameHeader = RECORD
  725.     dataLength: INTEGER;                        { length excludes the space for the length field }
  726.     END;
  727.  
  728. CONST
  729. kPathNameMaxBytesMinusSizeofInteger = kPathNameMaxBytes - sizeof(INTEGER);
  730.  
  731. TYPE
  732. PackedPathName = RECORD
  733.     dataLength: INTEGER;
  734.     
  735.     data: PACKED ARRAY[1..kPathNameMaxBytesMinusSizeofInteger] OF Byte;
  736.     END;
  737.  
  738.  
  739. {
  740. struct ProtoPackedPathName is a minimum-sized structure.  Use this
  741. for a variable-length packed PathName.
  742. }
  743.  
  744. ProtoPackedPathName = RECORD
  745.     dataLength: INTEGER;
  746.     
  747.     { Followed by data }
  748.     END;
  749.  
  750. PackedPathNamePtr = ^PackedPathName;
  751. ProtoPackedPathNamePtr = ^ProtoPackedPathName;
  752.  
  753.  
  754.  
  755.  
  756. {
  757. Copy the contents of path1 to path2.  path2Length is the size of path2, and must
  758. be large enough to hold a copy of path1.  A memFull error will be returned if that
  759. is not the case.
  760. }
  761.  
  762. FUNCTION OCECopyPackedPathName(path1: PackedPathName; VAR path2: PackedPathName;
  763.         path2Length: INTEGER): OSErr;
  764.     INLINE $303C, kOCECopyPackedPathName, $AA5C;
  765.  
  766.  
  767. {
  768. Returns true if packed path pointer is nil, or is of zero length, or is of
  769. length 2 and nParts of zero.
  770. }
  771.  
  772. FUNCTION OCEIsNullPackedPathName(path: PackedPathName): BOOLEAN;
  773.     INLINE $303C, kOCEIsNullPackedPathName, $AA5C;
  774.  
  775.  
  776. {
  777. OCEUnpackPathName breaks apart the path into its component RStrings, writing STRING
  778. pointers into the array 'parts', which the client asserts can hold as many as
  779. 'nParts' elements. The number of parts actually found is returned.  STRINGs are
  780. placed in the array in order from lowest to highest.  The first pathName element
  781. beneath the root appears last.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO
  782. THE PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  783. WITH THE UNPACKED STRUCT AS WELL
  784. }
  785.  
  786. FUNCTION OCEUnpackPathName(path: PackedPathName; VAR parts: RStringPtr;
  787.         nParts: INTEGER): INTEGER;
  788.     INLINE $303C, kOCEUnpackPathName, $AA5C;
  789.  
  790.  
  791. {
  792. OCEPackedPathNameSize computes the number of bytes of memory needed to hold a
  793. PackedPathName manufactured from the array of parts.  This length
  794. includes the length of the length field of PackedPathName, so it
  795. is safe to do a NewPtr (OCEPackedPathNameSize(...)).
  796. }
  797.  
  798. FUNCTION OCEPackedPathNameSize(VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  799.     INLINE $303C, kOCEPackedPathNameSize, $AA5C;
  800.  
  801.  
  802. { OCEDNodeNameCount returns the number of RStrings contained within the path. }
  803.  
  804. FUNCTION OCEDNodeNameCount(path: PackedPathName): INTEGER;
  805.     INLINE $303C, kOCEDNodeNameCount, $AA5C;
  806.  
  807.  
  808. {
  809. OCEPackPathName packs the parts into the storage provided as 'path'.  path must be
  810. large enough to hold the packed pathname.  A memFull error will be returned if
  811. pathLength is too small.  parts[0] should contain the deepest pathName element,
  812. and parts[nParts - 1] should contain the name of the first pathName element beneath
  813. the root.
  814. }
  815.  
  816. FUNCTION OCEPackPathName(VAR parts: RStringPtr; nParts: INTEGER;
  817.         VAR path: PackedPathName; pathLength: INTEGER): OSErr;
  818.     INLINE $303C, kOCEPackPathName, $AA5C;
  819.  
  820.  
  821. {
  822. Check the equality of two packed paths.
  823. }
  824.  
  825. FUNCTION OCEEqualPackedPathName(path1: PackedPathName;
  826.                     path2: PackedPathName): BOOLEAN;
  827.     INLINE $303C, kOCEEqualPackedPathName, $AA5C;
  828.  
  829.  
  830. {
  831. OCEValidPackedPathName checks that the packed PathName is internally consistent.
  832. Returns true if it's ok.
  833. }
  834.  
  835. FUNCTION OCEValidPackedPathName(path: PackedPathName): BOOLEAN;
  836.     INLINE $303C, kOCEValidPackedPathName, $AA5C;
  837.  
  838.  
  839.  
  840.  
  841. {*** DirDiscriminator ***}
  842.  
  843. TYPE
  844. DirDiscriminator = RECORD
  845.     signature: OCEDirectoryKind;
  846.     misc: LONGINT;
  847.     END;
  848.  
  849.  
  850.  
  851.  
  852. { Copies the value of disc1 to disc2. }
  853.  
  854. PROCEDURE OCECopyDirDiscriminator(disc1: DirDiscriminator;
  855.         VAR disc2: DirDiscriminator);
  856.     INLINE $303C, kOCECopyDirDiscriminator, $AA5C;
  857.  
  858.  
  859. { Check the equality of two DirDiscriminators. }
  860.  
  861. FUNCTION OCEEqualDirDiscriminator(disc1: DirDiscriminator;
  862.         disc2: DirDiscriminator): BOOLEAN;
  863.     INLINE $303C, kOCEEqualDirDiscriminator, $AA5C;
  864.  
  865.  
  866.  
  867. {********************************************************************************
  868.  
  869. This structure is called RLI because it really contains all the info you
  870. need to locate a record within the entire name space.  It contains four fields.
  871. The first two are the name of the directory and a directory discriminator.  These
  872. two fields are used to indicate to which directory a given record belongs.  The
  873. discriminator is used to distinguish between two different directories that have
  874. the same name.
  875.  
  876. The other two fields in the RLI structure are used to indicate a particular
  877. directory node within the directory specified by the directoryName and
  878. discriminator fields.  These fields are exactly analagous to the dirID and
  879. pathname used in HFS.  It is possible to specify a dNode just by dNodeNumber
  880. (pathname is nil), or just by pathname (dNodeNumber is set to kNULLDNodeNumber),
  881. or by a combination of the two.  The latter is called a 'partial pathname', and
  882. while it is valid in the Directory Manager API, it is not supported by ADAP
  883. directories in Release 1.
  884.  
  885. Note that the path parameter does not include the directory name, but holds
  886. the names of all the nodes on the path to the desired directory node, starting
  887. with the directory node and working its way up the tree.
  888.  
  889.  ********************************************************************************}
  890.  
  891.  
  892. {*** RLI ***}
  893.  
  894.  
  895. TYPE
  896. DirectoryName = RECORD
  897.     charSet: CharacterSet;
  898.     dataLength: INTEGER;
  899.  
  900.     body: PACKED ARRAY[1..kDirectoryNameMaxBytes] OF Byte;    { space for directory name }
  901.     END;
  902.  
  903. DirectoryNamePtr = ^DirectoryName;
  904.  
  905.  
  906. DNodeNum = LONGINT;                        { Directory node number }
  907.  
  908. RLI = RECORD                            { Record Location Info structure: }
  909.     directoryName: DirectoryNamePtr;    { pointer to the name of the directory root }
  910.     discriminator: DirDiscriminator;    { used to discriminate between dup dir names }
  911.     dNodeNumber: DNodeNum;                { number of the node }
  912.     path: PackedPathNamePtr;            { old-style RLI }
  913.     END;
  914.  
  915. RLIPtr = ^RLI;
  916.  
  917.  
  918.  
  919.  
  920.  
  921. {
  922. Create a new RLI from the directory name, discriminator, DNode number, and
  923. PackedPathName.  You must allocate the storage for the RLI and pass in a pointer
  924. to it.
  925. }
  926.  
  927. PROCEDURE OCENewRLI(VAR newRLI: RLI; dirName: DirectoryName;
  928.         VAR discriminator: DirDiscriminator; dNodeNumber: DNodeNum;
  929.         path: PackedPathName);
  930.     INLINE $303C, kOCENewRLI, $AA5C;
  931.  
  932.  
  933. {
  934. Duplicate the contents of rli1 to rli2.  No errors are returned. This
  935. simply copies the pointers to the directory name and path, wiping out any pointer
  936. that you might have had in there.
  937. }
  938.  
  939. PROCEDURE OCEDuplicateRLI(rli1: RLI; VAR rli2: RLI);
  940.     INLINE $303C, kOCEDuplicateRLI, $AA5C;
  941.  
  942.  
  943. {
  944. Copy the contents of rli1 to rli2.  rli2 must already contain
  945. pointers to structures large enough to hold copies of the corresponding
  946. fields from rli1.  A memFull error will be returned if that is not the case.
  947. So if you allocate a brand new empty destination, you must at least set up
  948. its length fields.
  949. }
  950.  
  951. FUNCTION OCECopyRLI(rli1: RLI; VAR rli2: RLI): OSErr;
  952.     INLINE $303C, kOCECopyRLI, $AA5C;
  953.  
  954.  
  955. {
  956. Check the equality of two RLIs.  This will take into account differences
  957. in the case and diacriticals of the directoryName and the PathName.
  958. NOTE THAT THIS WILL FAIL IF rli1 CONTAINS A DNODENUMBER AND A NIL PATHNAME,
  959. AND rli2 CONTAINS kNULLDNodeNumber AND A NON-NIL PATHNAME.  IN OTHER WORDS,
  960. THE TWO rlis MUST BE OF THE SAME FORM TO CHECK FOR EQUALITY.
  961. The one exception is that if the pathname is nil, a dNodeNumber of zero and
  962. kRootDNodeNumber will be treated as equal.
  963. }
  964.  
  965. FUNCTION OCEEqualRLI(rli1: RLI; rli2: RLI): BOOLEAN;
  966.     INLINE $303C, kOCEEqualRLI, $AA5C;
  967.  
  968.  
  969. {
  970. Check the validity of an RLI.  This checks that the directory name length
  971. is within bounds, and the packed pathname (specified: if) is valid.
  972. }
  973.  
  974. FUNCTION OCEValidRLI(theRLI: RLI): BOOLEAN;
  975.     INLINE $303C, kOCEValidRLI, $AA5C;
  976.  
  977.  
  978.  
  979.  
  980. {*** PackedRLI ***}
  981.  
  982. {
  983. struct PackedRLI is a maximum-sized structure.  Allocate one of
  984. these and it will hold any valid packed pathname.
  985. }
  986.  
  987. CONST
  988. kRLIMaxBytes = (sizeof (RString) + sizeof (DirDiscriminator) +
  989.             sizeof (DNodeNum) + kPathNameMaxBytes);
  990.  
  991. TYPE
  992. PackedRLIHeader = RECORD
  993.     dataLength: INTEGER;                { length excludes the space for the length field }
  994.     END;
  995.  
  996. PackedRLI = RECORD
  997.     dataLength: INTEGER;
  998.     
  999.     data: PACKED ARRAY[1..kRLIMaxBytes] OF Byte;
  1000.     END;
  1001.  
  1002.  
  1003. {
  1004. struct ProtoPackedRLI is a minimum-sized structure.  Use this
  1005. for a variable-length packed RLI.
  1006. }
  1007.  
  1008. ProtoPackedRLI = RECORD
  1009.     dataLength: INTEGER;
  1010.     
  1011.     { Followed by data }
  1012.     END;
  1013.  
  1014.  
  1015. PackedRLIPtr = ^PackedRLI;
  1016. ProtoPackedRLIPtr = ^ProtoPackedRLI;
  1017.  
  1018. CONST
  1019. kMinPackedRLISize  = (sizeof (ProtoPackedRLI) +
  1020.             sizeof (DirDiscriminator) + sizeof (DNodeNum) +
  1021.             kMinPackedRStringLength + sizeof (ProtoPackedPathName));
  1022.  
  1023.  
  1024.  
  1025.  
  1026. {
  1027. Copy the contents of prli1 to prli2.  prli2Length is the size of prli2, and must
  1028. be large enough to hold a copy of prli1.  A memFull error will be returned if that
  1029. is not the case.
  1030. }
  1031.  
  1032. FUNCTION OCECopyPackedRLI(prli1: PackedRLI; VAR prli2: PackedRLI;
  1033.             prli2Length: INTEGER): OSErr;
  1034.     INLINE $303C, kOCECopyPackedRLI, $AA5C;
  1035.  
  1036.  
  1037. {
  1038. OCEUnpackRLI breaks apart the prli into its components, writing pointers into
  1039. the rli structure.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE
  1040. PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  1041. WITH THE UNPACKED STRUCT AS WELL
  1042. }
  1043.  
  1044. PROCEDURE OCEUnpackRLI(prli: PackedRLI; VAR theRLI: RLI);
  1045.     INLINE $303C, kOCEUnpackRLI, $AA5C;
  1046.  
  1047.  
  1048. {
  1049. OCEPackedRLISize computes the number of bytes of memory needed to hold a
  1050. PackedRLI manufactured from an RLI.  This length
  1051. includes the length of the length field of PackedRLI, so it
  1052. is safe to do a NewPtr (OCEPackedRLISize(...)).
  1053. }
  1054.  
  1055. FUNCTION OCEPackedRLISize(theRLI: RLI): INTEGER;
  1056.     INLINE $303C, kOCEPackedRLISize, $AA5C;
  1057.  
  1058.  
  1059. {
  1060. OCEPackRLI packs the RLI into the storage provided as 'prli'.  prli must be
  1061. large enough to hold the packed RLI.  A memFull error will be returned if
  1062. prliLength is too small.
  1063. }
  1064.  
  1065. FUNCTION OCEPackRLI(theRLI: RLI; VAR prli: PackedRLI; prliLength: INTEGER): OSErr;
  1066.     INLINE $303C, kOCEPackRLI, $AA5C;
  1067.  
  1068.  
  1069. {
  1070. OCEPackedRLIPartsSize computes the number of bytes of memory needed to hold a
  1071. PackedRLI manufactured from the parts of an RLI.  This length
  1072. includes the length of the length field of PackedRLI, so it
  1073. is safe to do a NewPtr (OCEPackedRLIPartsSize(...)).
  1074. }
  1075.  
  1076. FUNCTION OCEPackedRLIPartsSize(dirName: DirectoryName;
  1077.             VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  1078.     INLINE $303C, kOCEPackedRLIPartsSize, $AA5C;
  1079.  
  1080.  
  1081. {
  1082. OCEPackRLIParts packs the parts of an RLI into the storage provided as 'prli'.
  1083. prli must be large enough to hold the packed RLI.  A memFull error will be returned
  1084. if prliLength is too small.
  1085. }
  1086.  
  1087. FUNCTION OCEPackRLIParts(dirName: DirectoryName;
  1088.             discriminator: DirDiscriminator; dNodeNumber: DNodeNum;
  1089.             VAR parts: RStringPtr; nParts: INTEGER; VAR prli: PackedRLI;
  1090.             prliLength: INTEGER): OSErr;
  1091.     INLINE $303C, kOCEPackRLIParts, $AA5C;
  1092.  
  1093.  
  1094. {
  1095. Check the equality of two packed prlis.
  1096. }
  1097.  
  1098. FUNCTION OCEEqualPackedRLI(prli1: PackedRLI; prli2: PackedRLI): BOOLEAN;
  1099.     INLINE $303C, kOCEEqualPackedRLI, $AA5C;
  1100.  
  1101.  
  1102. {
  1103. Check the validity of a packed RLI.  This checks that the directory name length
  1104. is within bounds, and the packed pathname (specified: if) is valid.
  1105. }
  1106.  
  1107. FUNCTION OCEValidPackedRLI(prli: PackedRLI): BOOLEAN;
  1108.     INLINE $303C, kOCEValidPackedRLI, $AA5C;
  1109.  
  1110.  
  1111. {
  1112. If this packed RLI describes a Personal Directory, this call will return a pointer
  1113. to an alias record that can be used to find the actual file.  Otherwise, it returns nil.
  1114. }
  1115.  
  1116. FUNCTION OCEExtractAlias(prli: PackedRLI): AliasPtr;
  1117.     INLINE $303C, kOCEExtractAlias, $AA5C;
  1118.  
  1119.  
  1120. {
  1121. This call returns a pointer to a packed RLI that represents the "Directories" icon, or
  1122. the root of all directories.  It is used in the CollabPack.
  1123. }
  1124.  
  1125. FUNCTION OCEGetDirectoryRootPackedRLI: PackedRLIPtr;
  1126.     INLINE $303C, kOCEGetRootPackedRLI, $AA5C;
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132. {*** LocalRecordID ***}
  1133.  
  1134. TYPE
  1135. LocalRecordID = RECORD
  1136.     cid: CreationID;
  1137.     recordName: RStringPtr;
  1138.     recordType: RStringPtr;
  1139.     END;
  1140.  
  1141.  
  1142. LocalRecordIDPtr = ^LocalRecordID;
  1143.  
  1144.  
  1145.  
  1146. { Create a LocalRecordID from a name, type, and CreationID }
  1147.  
  1148. PROCEDURE OCENewLocalRecordID(recordName: RString; recordType: RString;
  1149.         cid: CreationID; VAR lRID: LocalRecordID);
  1150.     INLINE $303C, kOCENewLocalRecordID, $AA5C;
  1151.  
  1152. {
  1153. Copy LocalRecordID lRID1 to LocalRecordID lRID2.  lRID2 must already contain
  1154. pointers to RString structures large enough to hold copies of the corresponding
  1155. fields from lRID1.  A memFull error will be returned if that is not the case.
  1156. So if you allocate a brand new empty destination, you must at least set up
  1157. its length field.
  1158. }
  1159.  
  1160. FUNCTION OCECopyLocalRecordID(lRID1: LocalRecordID; VAR lRID2: LocalRecordID): OSErr;
  1161.     INLINE $303C, kOCECopyLocalRecordID, $AA5C;
  1162.  
  1163.  
  1164. {
  1165. Check the equality of two local RIDs.
  1166. }
  1167.  
  1168. FUNCTION OCEEqualLocalRecordID(lRID1: LocalRecordID; lRID2: LocalRecordID): BOOLEAN;
  1169.     INLINE $303C, kOCEEqualLocalRecordID, $AA5C;
  1170.  
  1171.  
  1172.  
  1173.  
  1174. {*** ShortRecordID ***}
  1175.  
  1176. TYPE
  1177. ShortRecordID = RECORD
  1178.     rli: PackedRLIPtr;
  1179.     cid: CreationID;
  1180.     END;
  1181.  
  1182. ShortRecordIDPtr = ^ShortRecordID;
  1183.  
  1184.  
  1185.  
  1186. { Create a ShortRecordID from an RLI struct and a CreationID }
  1187.  
  1188. PROCEDURE OCENewShortRecordID(theRLI: PackedRLI; cid: CreationID;
  1189.         sRID: ShortRecordIDPtr);
  1190.     INLINE $303C, kOCENewShortRecordID, $AA5C;
  1191.  
  1192.  
  1193. {
  1194. Copy ShortRecordID sRID1 to ShortRecordID sRID2.  sRID2 must already contain
  1195. pointers to structures large enough to hold copies of the corresponding
  1196. fields from sRID1.  A memFull error will be returned if that is not the case.
  1197. So if you allocate a brand new empty destination, you must at least set up
  1198. its length fields.
  1199. }
  1200.  
  1201. FUNCTION OCECopyShortRecordID(sRID1: ShortRecordID; VAR sRID2: ShortRecordID): OSErr;
  1202.     INLINE $303C, kOCECopyShortRecordID, $AA5C;
  1203.  
  1204.  
  1205. {
  1206. Check the equality of two INTEGER RIDs.
  1207. }
  1208.  
  1209. FUNCTION OCEEqualShortRecordID(sRID1: ShortRecordID; sRID2: ShortRecordID): BOOLEAN;
  1210.     INLINE $303C, kOCEEqualShortRecordID, $AA5C;
  1211.  
  1212.  
  1213.  
  1214.  
  1215. {*** RecordID ***}
  1216.  
  1217. TYPE
  1218. RecordID = RECORD
  1219.     rli: PackedRLIPtr;    { pointer to a packed rli structure }
  1220.     local: LocalRecordID;
  1221.     END;
  1222.  
  1223. RecordIDPtr = ^RecordID;
  1224.  
  1225.  
  1226.  
  1227. {    Create a RecordID from a packed RLI struct and a LocalRecordID.
  1228. This doesn't allocate any new space; the RecordID points to the same
  1229. packed RLI struct and the same name and type RStrings. }
  1230.  
  1231. PROCEDURE OCENewRecordID(theRLI: PackedRLI; lRID: LocalRecordID;
  1232.             VAR rid: RecordID);
  1233.     INLINE $303C, kOCENewRecordID, $AA5C;
  1234.  
  1235.  
  1236. {
  1237. Copy RecordID RID1 to RecordID RID2.  RID2 must already contain
  1238. pointers to structures large enough to hold copies of the corresponding
  1239. fields from lRID1.  A memFull error will be returned if that is not the case.
  1240. So if you allocate a brand new empty destination, you must at least set up
  1241. its length fields.
  1242. }
  1243.  
  1244. FUNCTION OCECopyRecordID(rid1: RecordID; rid2: RecordID): OSErr;
  1245.     INLINE $303C, kOCECopyRecordID, $AA5C;
  1246.  
  1247.  
  1248. {    Check the equality of two RIDs. }
  1249.  
  1250. FUNCTION OCEEqualRecordID(rid1: RecordID; rid2: RecordID): BOOLEAN;
  1251.     INLINE $303C, kOCEEqualRecordID, $AA5C;
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257. {*** PackedRecordID ***}
  1258.  
  1259. {
  1260. struct PackedRecordID is a maximum-sized structure.  Allocate one of
  1261. these and it will hold any valid packed RecordID.
  1262. }
  1263.  
  1264. CONST
  1265. kPackedRecordIDMaxBytes = kPathNameMaxBytes + sizeof(DNodeNum) +
  1266.             sizeof(DirDiscriminator) + sizeof(CreationID) + (3*sizeof(RString));
  1267.  
  1268. TYPE
  1269. PackedRecordIDHeader = RECORD
  1270.     dataLength: INTEGER;                    { length excludes the space for the length field }
  1271.     END;
  1272.     
  1273. PackedRecordID = RECORD
  1274.     dataLength: INTEGER;
  1275.     
  1276.     data: PACKED ARRAY[1..kPackedRecordIDMaxBytes] OF Byte;
  1277.     END;
  1278.  
  1279.  
  1280. {
  1281. struct ProtoPackedRecordID is a minimum-sized structure.  Use this
  1282. for a variable-length packed RecordID.
  1283. }
  1284.  
  1285. ProtoPackedRecordID = RECORD
  1286.     dataLength: INTEGER;
  1287.     
  1288.     { Followed by data }
  1289.     END;
  1290.  
  1291. PackedRecordIDPtr = ^PackedRecordID;
  1292. ProtoPackedRecordIDPtr = ^ProtoPackedRecordID;
  1293.  
  1294.  
  1295.  
  1296. {
  1297. Copy PackedRecordID pRID1 to PackedRecordID pRID2.  pRID2 must already contain
  1298. pointers to structures large enough to hold copies of the corresponding
  1299. fields from pRID1.  A memFull error will be returned if that is not the case.
  1300. pRID2Length is the number of bytes that can be put into pRID2, not counting the
  1301. packed RecordID header.
  1302. }
  1303.  
  1304. FUNCTION OCECopyPackedRecordID(pRID1: PackedRecordID; pRID2: PackedRecordID;
  1305.         pRID2Length: INTEGER): OSErr;
  1306.     INLINE $303C, kOCECopyPackedRecordID, $AA5C;
  1307.  
  1308.  
  1309. {
  1310. Create a RecordID from a PackedRecordID.
  1311. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  1312. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL
  1313. }
  1314.  
  1315. PROCEDURE OCEUnpackRecordID(pRID: PackedRecordID; VAR rid: RecordID);
  1316.     INLINE $303C, kOCEUnpackRecordID, $AA5C;
  1317.  
  1318.  
  1319. {
  1320. Create a PackedRecordID from a RecordID.  pRID must be large enough to contain
  1321. the packed RecordID.  A memFull error will be returned if that is not the case.
  1322. packedRecordIDLength is the number of bytes that can be put into pRID, not
  1323. counting the header.
  1324. }
  1325.  
  1326. FUNCTION OCEPackRecordID(rid: RecordID; pRID: PackedRecordIDPtr;
  1327.         packedRecordIDLength: INTEGER): OSErr;
  1328.     INLINE $303C, kOCEPackRecordID, $AA5C;
  1329.  
  1330.  
  1331. {
  1332. Compute the number of bytes of memory needed to hold a RecordID when packed. This
  1333. length includes the length of the length field of PackedRecordID, so it
  1334. is safe to do a NewPtr (OCEPackedRecordIDSize(...)).
  1335. }
  1336.  
  1337. FUNCTION OCEPackedRecordIDSize(rid: RecordID): INTEGER;
  1338.     INLINE $303C, kOCEPackedRecordIDSize, $AA5C;
  1339.  
  1340.  
  1341. {
  1342. Check the equality of two packed RIDs.
  1343. }
  1344.  
  1345. FUNCTION OCEEqualPackedRecordID(pRID1: PackedRecordID; pRID2: PackedRecordID): BOOLEAN;
  1346.     INLINE $303C, kOCEEqualPackedRecordID, $AA5C;
  1347.  
  1348.  
  1349. { OCEValidPackedRecordID checks the validity of a packed record ID. }
  1350.  
  1351. FUNCTION OCEValidPackedRecordID(pRID: PackedRecordID): BOOLEAN;
  1352.     INLINE $303C, kOCEValidPackedRecordID, $AA5C;
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358. {*** DSSpec ***}
  1359.  
  1360. TYPE
  1361. DSSpec = RECORD
  1362.     entitySpecifier: ^RecordID;
  1363.     extensionType: OSType;
  1364.     extensionSize: INTEGER;
  1365.     extensionValue: Ptr;
  1366.     END;
  1367.  
  1368. DSSpecPtr = ^DSSpec;
  1369.  
  1370. {
  1371. struct PackedDSSpec is NOT a maximum-sized structure.  Allocate one of
  1372. these and it will hold any valid packed RecordID, but not necessarily any additional
  1373. data.
  1374. }
  1375.  
  1376. CONST
  1377. kPackedDSSpecMaxBytes    = (sizeof (PackedRecordID) + sizeof (OSType) + sizeof (INTEGER));
  1378.  
  1379. TYPE
  1380. PackedDSSpecHeader = RECORD
  1381.     dataLength: INTEGER;            { length excludes the space for the length field }
  1382.     END;
  1383.         
  1384. PackedDSSpec = RECORD
  1385.     dataLength: INTEGER;
  1386.     
  1387.     data: PACKED ARRAY[1..kPackedDSSpecMaxBytes] OF Byte;
  1388.     END;
  1389.  
  1390.  
  1391. {
  1392. struct ProtoPackedDSSpec is a minimum-sized structure.  Use this
  1393. for a variable-length packed DSSpec.
  1394. }
  1395.  
  1396. ProtoPackedDSSpec = RECORD
  1397.     dataLength: INTEGER;
  1398.     
  1399.     { Followed by data }
  1400.     END;
  1401.  
  1402. PackedDSSpecPtr = ^PackedDSSpec;
  1403. ProtoPackedDSSpecPtr = ^ProtoPackedDSSpec;
  1404.  
  1405.  
  1406.  
  1407. {
  1408. Copy PackedDSSpec pdss1 to PackedDSSpec pdss2.  pdss2 must already contain
  1409. pointers to structures large enough to hold copies of the corresponding
  1410. fields from pdss1.  A memFull error will be returned if that is not the case.
  1411. pdss2Length is the number of bytes that can be put into pdss2, not counting the
  1412. packed DSSpec header.
  1413. }
  1414.  
  1415. FUNCTION OCECopyPackedDSSpec(pdss1: PackedDSSpec;
  1416.             pdss2: PackedDSSpec; pdss2Length: INTEGER): OSErr;
  1417.     INLINE $303C, kOCECopyPackedDSSpec, $AA5C;
  1418.  
  1419.  
  1420. {
  1421. Create a DSSpec from a PackedDSSpec.
  1422. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  1423. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL.
  1424. A pointer to the extension is returned in dss->extensionValue, and the length of that
  1425. extension is returned in dss->extensionSize.  If there is no extension, dss->extensionValue will
  1426. be set to nil.  This routine will unpack the RecordID (any: if) into rid, unpack the rest
  1427. into dss, and set dss->entitySpecifier to rid.
  1428. }
  1429.  
  1430. PROCEDURE OCEUnpackDSSpec(pdss: PackedDSSpec; VAR dss: DSSpec;
  1431.             VAR rid: RecordID); INLINE $303C, kOCEUnpackDSSpec, $AA5C;
  1432.  
  1433.  
  1434. {
  1435. Create a PackedDSSpec from a DSSpec.  pdss must be large enough to
  1436. contain the packed RecordID and any extension.  A memFull error will be returned if that
  1437. is not the case.  pdssLength is the number of bytes that can be put into pdss,
  1438. not counting the header.
  1439. }
  1440.  
  1441. FUNCTION OCEPackDSSpec(dss: DSSpec; VAR pdss: PackedDSSpec;
  1442.         pdssLength: INTEGER): OSErr;
  1443.     INLINE $303C, kOCEPackDSSpec, $AA5C;
  1444.  
  1445.  
  1446. {
  1447. Compute the number of bytes of memory needed to hold a DSSpec when packed. This
  1448. length includes the length of the length field of PackedDSSpec, so it
  1449. is safe to do a NewPtr (OCEPackedDSSpecSize(...)).
  1450. }
  1451.  
  1452. FUNCTION OCEPackedDSSpecSize(dss: DSSpec): INTEGER;
  1453.     INLINE $303C, kOCEPackedDSSpecSize, $AA5C;
  1454.  
  1455.  
  1456. {    Check the equality of two DSSpecs.  This compares all fields, even the
  1457. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1458. diacrit-insensitive manner. }
  1459.  
  1460. FUNCTION OCEEqualDSSpec(pdss1: DSSpec; pdss2: DSSpec): BOOLEAN;
  1461.     INLINE $303C, kOCEEqualDSSpec, $AA5C;
  1462.  
  1463.  
  1464. {    Check the equality of two PackedDSSpecs.  This compares all fields, even the
  1465. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1466. diacrit-insensitive manner. }
  1467.  
  1468. FUNCTION OCEEqualPackedDSSpec(pdss1: PackedDSSpec;
  1469.         pdss2: PackedDSSpec): BOOLEAN;
  1470.     INLINE $303C, kOCEEqualPackedDSSpec, $AA5C;
  1471.  
  1472.  
  1473. {
  1474. Check the validity of a PackedDSSpec.  If extensionType is
  1475. 'entn', pdss must contain a valid entitySpecifier.  For all other extensionTypes, a nil
  1476. entitySpecifier is valid, but if non-nil, it will be checked for validity.  No check
  1477. is made on the extension.
  1478. }
  1479.  
  1480. FUNCTION OCEValidPackedDSSpec(pdss: PackedDSSpec): BOOLEAN;
  1481.     INLINE $303C, kOCEValidPackedDSSpec, $AA5C;
  1482.  
  1483.  
  1484. {
  1485. Return info about a DSSpec.  This routine does not check validity.  If the
  1486. DSSpec has no extension, we determine whether it represents the root of all
  1487. directories, a single directory, a DNode, or a Record.  Else it is invalid.
  1488. If the DSSpec has an extension, we simply return the extension type.
  1489. }
  1490.  
  1491. FUNCTION OCEGetDSSpecInfo(spec: DSSpec): OSType;
  1492.     INLINE $303C, kOCEGetDSSpecInfo, $AA5C;
  1493.  
  1494.  
  1495. { OCEGetExtensionType returns the extensionType imbedded in the PackedDSSpec. }
  1496.  
  1497. FUNCTION OCEGetExtensionType(pdss: PackedDSSpec): OSType;
  1498.     INLINE $303C, kOCEGetXtnType, $AA5C;
  1499.  
  1500.  
  1501. {
  1502. OCEStreamPackedDSSpec streams (flattens) a directory object a little at a time by
  1503. calling the DSSpecStreamer routine that you provide.
  1504. }
  1505.  
  1506. TYPE
  1507. DSSpecStreamer = ProcPtr;
  1508.     { FUNCTION DSSpecStreamer(VAR buffer: void; count: LONGINT; eof: BOOLEAN;
  1509.         userData: LONGINT): OSErr;}
  1510.  
  1511. FUNCTION OCEStreamPackedDSSpec(dss: DSSpec; stream: DSSpecStreamer;
  1512.         userData: LONGINT; VAR actualCount: LONGINT): OSErr;
  1513.     INLINE $303C, kOCEStreamPackedDSSpec, $AA5C;
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519. {*** AttributeType ***}
  1520.  
  1521. {
  1522. For the record, an AttributeType is an RString with a smaller maximum size.
  1523. I don't justtypedef it to an RString, because I want the definition of the AttributeType
  1524. struct to contain the max length, because I need to include it in the Attribute struct
  1525. below.  But it should be possible to typecast any AttributeType to an RString and use
  1526. all the RString utilities on it.
  1527. }
  1528.  
  1529. TYPE
  1530. AttributeType = RECORD
  1531.     charSet: CharacterSet;
  1532.     dataLength: INTEGER;
  1533.  
  1534.     body: PACKED ARRAY[1..kAttributeTypeMaxBytes] OF Byte;
  1535.                                         { always fixed at the max size }
  1536.     END;
  1537.  
  1538. AttributeTypePtr = ^AttributeType;
  1539.  
  1540.  
  1541.  
  1542. {*** AttributeValue ***}
  1543.  
  1544. AttributeTag = DescType;            { same class as is used in AppleEvents }
  1545.  
  1546. AttributeValue = RECORD
  1547.     tag: AttributeTag;
  1548.     dataLength: LONGINT;
  1549.     bytes: Ptr;
  1550.     END;
  1551.  
  1552. AttributeValuePtr = ^AttributeValue;
  1553.  
  1554.  
  1555. {*** Attribute ***}
  1556.  
  1557. Attribute = RECORD
  1558.     attributeType: AttributeType;
  1559.     cid: AttributeCreationID;
  1560.     value: AttributeValue;
  1561.     END;
  1562.  
  1563. AttributePtr = ^Attribute;
  1564.  
  1565.  
  1566.  
  1567. FUNCTION OCEGetIndRecordType(STRINGIndex: OCERecordTypeIndex): RStringPtr;
  1568.     INLINE $303C, kOCEGetIndRecordType, $AA5C;
  1569.  
  1570. FUNCTION OCEGetIndAttributeType(STRINGIndex: OCEAttributeTypeIndex): AttributeTypePtr;
  1571.     INLINE $303C, kOCEGetIndAttributeType, $AA5C;
  1572.  
  1573.  
  1574. CONST
  1575. _oceTBDispatch            = $AA5E;
  1576.  
  1577.  
  1578.  
  1579.  
  1580. {$ENDC}    { UsingOCE }
  1581.  
  1582. {$IFC NOT UsingIncludes}
  1583.     END.
  1584. {$ENDC}
  1585.